<?php
$difficulty = array(
    1160 => 5,
    1190 => 5,
    1370 => 5,
    1377 => 5,
    1388 => 5,
    1189 => 5,
    1220 => 5,
    1221 => 5,
    1121 => 5,
    1252 => 5,
    1350 => 5,
    1179 => 5,
    1363 => 5,
    1231 => 5,
    1390 => 5,
    1258 => 5,
    1335 => 5,
    1217 => 5,
    1256 => 5,
    1135 => 5,
    1174 => 5,
    1421 => 5,
    1375 => 5,
    1297 => 5,
    1241 => 5,
    1117 => 5,
    1178 => 5,
    1364 => 5,
    1307 => 5,
    1091 => 5,
    1270 => 5,
    1422 => 5,
    1423 => 5,
    1238 => 5,
    1260 => 5,
    1156 => 5,
    1373 => 5,
    1129 => 5,
    1285 => 5,
    1188 => 5,
    1417 => 5,
    1304 => 5,
    1219 => 5,
    1321 => 5,
    1305 => 5,
    1261 => 5,
    1193 => 5,
    1158 => 5,
    1120 => 5,
    1136 => 5,
    1095 => 5,
    1381 => 5,
    1354 => 5,
    1236 => 5,
    1059 => 5,
    1235 => 5,
    1342 => 5,
    1318 => 5,
    1108 => 5,
    1218 => 5,
    1331 => 5,
    1056 => 5,
    1093 => 5,
    1053 => 5,
    1391 => 5,
    1027 => 5,
    1215 => 5,
    1404 => 5,
    1054 => 5,
    1325 => 5,
    1127 => 5,
    1401 => 5,
    1066 => 5,
    1164 => 5,
    1201 => 5,
    1112 => 5,
    1415 => 5,
    1346 => 5,
    1025 => 5,
    1138 => 5,
    1400 => 5,
    1159 => 5,
    1409 => 5,
    1079 => 5,
    1139 => 5,
    1090 => 5,
    1031 => 5,
    1208 => 5,
    1104 => 5,
    1111 => 5,
    1353 => 5,
    1399 => 5,
    1336 => 5,
    1099 => 5,
    1101 => 5,
    1389 => 5,
    1361 => 5,
    1067 => 5,
    1140 => 5,
    1149 => 5,
    1210 => 5,
    1072 => 5,
    1344 => 5,
    1041 => 5,
    1116 => 5,
    1043 => 5,
    1062 => 5,
    1290 => 5,
    1088 => 5,
    1315 => 5,
    1146 => 5,
    1012 => 5,
    1338 => 5,
    1206 => 5,
    1004 => 5,
    1170 => 5,
    1060 => 5,
    1412 => 5,
    1204 => 5,
    1352 => 5,
    1003 => 5,
    1355 => 5,
    1002 => 5,
    1057 => 3,
    1418 => 3,
    1044 => 3,
    1263 => 3,
    1310 => 3,
    1362 => 3,
    1161 => 3,
    1387 => 3,
    1419 => 3,
    1163 => 3,
    1365 => 3,
    1243 => 3,
    1386 => 3,
    1068 => 3,
    1181 => 3,
    1151 => 3,
    1233 => 3,
    1237 => 3,
    1130 => 3,
    1096 => 3,
    1125 => 3,
    1280 => 3,
    1299 => 3,
    1395 => 3,
    1063 => 3,
    1198 => 3,
    1030 => 3,
    1379 => 3,
    1078 => 3,
    1118 => 3,
    1380 => 3,
    1105 => 3,
    1385 => 3,
    1357 => 3,
    1267 => 3,
    1086 => 3,
    1337 => 3,
    1153 => 3,
    1393 => 3,
    1407 => 3,
    1061 => 3,
    1384 => 3,
    1292 => 3,
    1405 => 3,
    1250 => 3,
    1177 => 3,
    1042 => 3,
    1374 => 3,
    1371 => 3,
    1076 => 3,
    1033 => 3,
    1084 => 3,
    1214 => 3,
    1259 => 3,
    1150 => 3,
    1186 => 3,
    1196 => 3,
    1094 => 3,
    1176 => 3,
    1109 => 3,
    1102 => 3,
    1324 => 3,
    1302 => 3,
    1168 => 3,
    1199 => 3,
    1230 => 3,
    1070 => 3,
    1169 => 3,
    1319 => 3,
    1207 => 3,
    1197 => 3,
    1341 => 3,
    1144 => 3,
    1343 => 3,
    1148 => 3,
    1128 => 3,
    1049 => 3,
    1229 => 3,
    1024 => 3,
    1187 => 3,
    1232 => 3,
    1200 => 3,
    1313 => 3,
    1075 => 3,
    1165 => 3,
    1048 => 3,
    1155 => 3,
    1175 => 3,
    1011 => 3,
    1358 => 3,
    1356 => 3,
    1291 => 3,
    1403 => 3,
    1082 => 3,
    1171 => 3,
    1173 => 3,
    1147 => 3,
    1166 => 3,
    1345 => 3,
    1089 => 3,
    1172 => 3,
    1083 => 3,
    1211 => 3,
    1224 => 3,
    1126 => 3,
    1301 => 3,
    1023 => 3,
    1392 => 3,
    1092 => 3,
    1406 => 3,
    1098 => 3,
    1077 => 3,
    1073 => 3,
    1015 => 3,
    1019 => 3,
    1038 => 3,
    1152 => 3,
    1069 => 3,
    1008 => 3,
    1017 => 3,
    1039 => 3,
    1123 => 3,
    1081 => 3,
    1006 => 3,
    1022 => 3,
    1100 => 3,
    1162 => 3,
    1398 => 3,
    1018 => 3,
    1087 => 3,
    1141 => 3,
    1340 => 3,
    1058 => 3,
    1037 => 3,
    1021 => 3,
    1142 => 3,
    1045 => 3,
    1036 => 3,
    1410 => 3,
    1047 => 3,
    1014 => 3,
    1074 => 3,
    1349 => 3,
    1016 => 3,
    1202 => 3,
    1416 => 3,
    1080 => 3,
    1071 => 3,
    1034 => 3,
    1203 => 3,
    1029 => 3,
    1145 => 3,
    1005 => 3,
    1064 => 3,
    1411 => 3,
    1414 => 3,
    1020 => 3,
    1347 => 3,
    1212 => 3,
    1007 => 3,
    1010 => 3,
    1013 => 3,
    1051 => 1,
    1333 => 1,
    1408 => 1,
    1180 => 1,
    1309 => 1,
    1334 => 1,
    1420 => 1,
    1122 => 1,
    1269 => 1,
    1132 => 1,
    1110 => 1,
    1303 => 1,
    1378 => 1,
    1226 => 1,
    1271 => 1,
    1311 => 1,
    1339 => 1,
    1052 => 1,
    1251 => 1,
    1276 => 1,
    1124 => 1,
    1283 => 1,
    1194 => 1,
    1222 => 1,
    1240 => 1,
    1372 => 1,
    1284 => 1,
    1332 => 1,
    1268 => 1,
    1383 => 1,
    1316 => 1,
    1223 => 1,
    1274 => 1,
    1329 => 1,
    1106 => 1,
    1264 => 1,
    1192 => 1,
    1262 => 1,
    1396 => 1,
    1185 => 1,
    1265 => 1,
    1254 => 1,
    1281 => 1,
    1228 => 1,
    1209 => 1,
    1300 => 1,
    1085 => 1,
    1227 => 1,
    1195 => 1,
    1032 => 1,
    1296 => 1,
    1097 => 1,
    1113 => 1,
    1213 => 1,
    1295 => 1,
    1288 => 1,
    1330 => 1,
    1184 => 1,
    1216 => 1,
    1287 => 1,
    1328 => 1,
    1225 => 1,
    1107 => 1,
    1286 => 1,
    1167 => 1,
    1134 => 1,
    1119 => 1,
    1133 => 1,
    1314 => 1,
    1009 => 1,
    1402 => 1,
    1294 => 1,
    1293 => 1,
    1050 => 1,
    1065 => 1,
    1289 => 1,
    1157 => 1,
    1103 => 1,
    1114 => 1,
    1115 => 1,
    1055 => 1,
    1040 => 1,
    1154 => 1,
    1028 => 1,
    1046 => 1,
    1026 => 1,
    1137 => 1,
    1413 => 1,
    1351 => 1,
    1143 => 1,
    1035 => 1,
    1001 => 1,
);

ob_start();

//$land = new mysqli('localhost', 'root', '123456', 'land');

echo 'USE land;', PHP_EOL;
echo 'ALTER TABLE problems ADD difficulty int NOT NULL default 0 AFTER enabled;', PHP_EOL;

$sql = 'UPDATE problems SET enabled = 0;';
//$land->query($sql);
echo $sql, PHP_EOL;

foreach ($difficulty as $k => $v) {
    $sql = "UPDATE problems SET enabled=1, difficulty=$v WHERE problem_id=$k;";
    echo $sql, PHP_EOL;
}

$sql = ob_get_contents();
ob_end_clean();

file_put_contents('difficulty.sql', $sql);

?>
